﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main/Site.Master" AutoEventWireup="true"
    ViewStateMode="Disabled" CodeBehind="ArticleListView.aspx.cs" Inherits="LongSpeed.WebSite.Main.ArticleListView" %>

<%@ OutputCache Duration="420" VaryByParam="apart;pageIndex" NoStore="true" Location="Any" %>
<%@ Import Namespace="LongSpeed.WebSite.Behaviors" %>
<%@ Register Src="~/UserControl/ucKnowledgeNavigator.ascx" TagName="KnowledgeNavigator"
    TagPrefix="uc" %>
<%@ Register Src="~/UserControl/ucPaymentMode.ascx" TagName="PaymentMode" TagPrefix="uc" %>
<%@ Register Src="~/UserControl/ServerTree.ascx" TagName="ServerTree" TagPrefix="uc" %>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
    <link href="../Styles/content.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="articleListViewContent" ContentPlaceHolderID="PlaceHolder" runat="server">
    <style type="text/css">
        .bb
        {
            height: 780px;
        }
        .cc
        {
            min-height: 720px;
        }
    </style>
    <!--[if IE]>
        <style type="text/css">
            .bb{height:750px;}
            .cc{min-height: 690px;}
        </style>
    <![endif]-->
    <div>
        <div class="floatleft">
            <uc:ServerTree ID="ucst" runat="server" />
            <uc:KnowledgeNavigator ID="uckn" runat="server" />
            <uc:PaymentMode ID="ucpm" runat="server" />
        </div>
        <div id="mainarea">
            <div class="sblock2">
                <div class="sblock2-top">
                    <div class="articeltitle" style="background-image: none; width: auto; color: Black;
                        float: none;">
                        <h5>
                            <%
                                int part = Convert.ToInt32(Request.QueryString[LongSpeed.WebSite.Behaviors.SessionString.ArticlePart]);
                                LongSpeed.WebSite.Behaviors.Article article = new LongSpeed.WebSite.Behaviors.Article();

                                var p = new LongSpeed.WebSite.Behaviors.Part();
                                p.Init(part);

                                IList<Article> artivles = new List<Article>();

                                if (Request.QueryString["pageIndex"] != null)
                                {
                                    pageIndex = Convert.ToInt32(Request.QueryString["pageIndex"]);
                                    artivles = article.GetArticleByPage(part, pageIndex, pageCount, ref sumPageCount);
                                }
                                else
                                {
                                    pageIndex = 1;
                                    artivles = article.GetArticleByPage(part, pageIndex, pageCount, ref sumPageCount);
                                }                                                                    
                            %>
                            您的位置：<a href="../home.htm" title="首页" target="_parent">首页</a><span style="margin: 0px 5px;">></span>
                            <a title="<%=(p.Name) %>" target="_parent" href="<%=(string.Format("../articlelist-{0}.html", p.ID)) %>">
                                <%=(p.Name) %></a>
                        </h5>
                    </div>
                </div>
                <div class="sblock2-bottom bb contentpadding" id="pgs">
                    <%
                        if (artivles == null || artivles.Count == 0)
                        {
                            Response.Write("暂无数据");
                        }
                        else
                        {
                    %>
                    <div class="listinfo cc ">
                        <ul>
                            <%
                            foreach (var item in artivles)
                            {
                            %>
                            <li><a style="display: block; float: left;" title="<%=(item.Title) %>" target="_parent"
                                href="<%=(string.Format("new-{0}-{1}.html", item.ID, part)) %>">
                                <%=(item.Title)%></a> <span style="display: block; float: right">
                                    <%=(item.ReleaseDate.ToString("yyyy-MM-dd"))%></span>
                                <%
                                if ((DateTime.Now - item.ReleaseDate).Days < 3)
                                {
                                %>
                                <img src="../images/index/new.gif" alt="新" style="margin: -2px 0px 0px 2px" />
                                <%
                                }                                        
                                %>
                                <div class="clear">
                                </div>
                            </li>
                            <%
                            }
                            %>
                        </ul>
                        <%
                            string shouyeUrl;
                            string preUrl;
                            string nextUrl;
                            string moyeUrl;


                            if (string.IsNullOrEmpty(p.FromUrl) || string.IsNullOrWhiteSpace(p.FromUrl))
                            {
                                shouyeUrl = pageIndex > 1 ? string.Format("../articlelist-{0}.html", part) : "#";
                                preUrl = pageIndex > 1 ? string.Format("../articlelist-{0}-{1}.html", part, pageIndex - 1) : "#";
                                nextUrl = pageIndex < sumPageCount ? string.Format("../articlelist-{0}-{1}.html", part, pageIndex + 1) : "#";
                                moyeUrl = pageIndex < sumPageCount ? string.Format("../articlelist-{0}-{1}.html", part, sumPageCount) : "#";
                            }
                            else
                            {
                                shouyeUrl = pageIndex > 1 ? string.Format("../{0}", p.FromUrl) : "#";
                                preUrl = pageIndex > 1 ? string.Format("../{0}?{1}", p.FromUrl, pageIndex - 1) : "#";
                                nextUrl = pageIndex < sumPageCount ? string.Format("../{0}?{1}", p.FromUrl, pageIndex + 1) : "#";
                                moyeUrl = pageIndex < sumPageCount ? string.Format("../{0}?{1}", p.FromUrl, sumPageCount) : "#";
                            }

                            string style = pageIndex == 1 ? "style=\"color:Gray;\"" : "";
                            string style1 = pageIndex == sumPageCount ? "style=\"color:Gray;\"" : "";                                
                        %>
                    </div>
                    <div class=" listinfo fenye">
                        <a <%=(style) %> title="首页" href="<%=(shouyeUrl) %>" target="_parent">首页</a> <a <%=(style) %>
                            title="上一页" href="<%=(preUrl) %>" target="_parent">上一页</a> <a <%=(style1) %> title="下一页"
                                href="<%=(nextUrl) %>" target="_parent">下一页</a> <a <%=(style1) %> title="末页" href="<%=(moyeUrl) %>"
                                    target="_parent">末页</a> <span>当前<%=(artivles.Count) %>条数据 / 每页<%=(pageCount) %>条数据</span>
                        <span>当前第<%=(pageIndex) %>页 / 共<%=(sumPageCount) %>页</span>
                        <div class="clear">
                        </div>
                    </div>
                    <%
                        }
                    %>
                </div>
            </div>
        </div>
        <div class="clear">
        </div>
    </div>
</asp:Content>
